Skip to content

test(web): wait for Settings focus before testing the theme editor's Escape - #36754

Merged
juliusmarminge merged 1 commit into
mainfrom
factory/main-a575d45286
Nov 14, 2026
Merged

juliusmarminge merged 1 commit into
mainfrom
factory/main-a575d45286

Conversation

@juliusmarminge

Copy link
Copy Markdown
Member

Flaky test. ThemeEditorPanel.browser.test.tsx > 'closes on Escape without closing Settings' renders a modal Settings Dialog and the ThemeEditorPanel together. Base UI's FloatingFocusManager moves the dialog's initial focus in a requestAnimationFrame (enqueueFocus). When that frame lands after the test focuses the editor input (as can happen on a loaded CI runner), focus is pulled back into Settings and Escape never reaches the editor's onKeyDown, so onEditorOpenChange gets 0 calls (the CI failure). Reproduced deterministically by delaying requestAnimationFrame by 150ms in a scratch copy: identical failure; with the fix the same delayed copy passes. Not a product bug: in the app Settings is already open and focused before the editor opens. Fix: renderBesideSettings now waits until Settings' Close button has focus (expect.element(...).toHaveFocus()) before returning, which matches that real order. It also holds the screen in an AsyncDisposableStack so a failed wait still unmounts, as AGENTS.md asks. Test-only change, no retry, sleep or timeout.

Reproduction on main

Run the failing check on main.

Evidence

The checks on this pull request are the proof: it changes what main's checks run, not what the app does.

Tests

Before fix: vp test run --project browser src/components/settings/ThemeEditorPanel.browser.test.tsx 10/10 pass on origin/main (flake not reproduced naturally). Scratch repro with requestAnimationFrame delayed 150ms: fails with 'Number of calls: 0'; with the fix: 5/5 tests pass. After fix: the full file passed 25 consecutive times, before and again after the AsyncDisposableStack refactor (25/25 each). vp run check:changed: format, lint, knip, typecheck (2 packages), test all pass.

Not in this change

  • The 'ConnectionTransientError: Remote environment endpoint returned an invalid response' line in the CI log comes from another test's logged output and is unrelated to this failure.

Who did the work

  • Written by Claude Opus 5.5, in Claude Code
  • Reviewed by GPT-6.1 Sol, in Codex, and by Claude Opus 5.5, each on its own

Run by the t3code factory in T3 Code.

…Escape

Settings' modal dialog moves focus to its first control on a later
animation frame. When that frame landed after the test focused the
theme editor's input, focus went back to Settings and Escape never
reached the editor. Wait for Settings to hold focus first, as it does
in the app before the editor opens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 14, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 02d1de1

Macroscope's review found this PR approvable — The changes are confined to an ignored file and are described as stabilizing focus timing in a theme-editor test. The supplied scope indicates no material change to production behavior.

Notes:

  • No code objects were reviewed. Approvability was decided on eligibility alone.

You can add or adjust custom eligibility rules. Learn more.

@juliusmarminge
juliusmarminge merged commit 76748e9 into main Nov 14, 2026
35 of 36 checks passed
@juliusmarminge
juliusmarminge deleted the factory/main-a575d45286 branch November 14, 2026 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant